#include <iostream>
#include <cstring>

using namespace std;

class CTextBlock
{
public:
    std::size_t length() const;
private:
    char *pText;
    /**
     *const可以改变
     *mutable std::size_t textLength;
     *mutable bool lengthIsValid;
     */
    std::size_t textLength;
    bool lengthIsValid;
};

std::size_t CTextBlock::length() const
{
    if (!lengthIsValid)
    {
        textLength = std::strlen(pText);
        lengthIsValid = true;
    }

    return textLength;
}

int main(int argc, char *argv[])
{
    return 0;
}
